package com.doctcloud.hisinfo.histable.domain.medrec;

import com.baomidou.mybatisplus.annotation.TableName;
import com.doctcloud.common.core.annotation.NotZero;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.doctcloud.common.core.annotation.Excel;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

import static com.doctcloud.common.core.utils.StringUtils.trim;

/**
 * @ClassName 患者在科记录
 * @Author samula
 * @Descripe product by com.doctcloud
 * @Data 2025-09-23 1:21
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(of = {"patientId", "visitId", "admissionDateTime"})
@ToString
public class TransferDo implements Serializable {
    private static final long serialVersionUID = 1L;
    /** 患者ID */
    @Excel(name = "患者ID")
    @NotBlank(message = "患者ID不得为空")
    private String  patientId;
    /** 住院标识 */
    @Excel(name = "住院标识号")
    @NotZero(message = "住院标识号不得为空或为零")
    private Integer visitId;
    @Excel(name="所在科室代码")
    private String deptStayed;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "入科时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message = "入科时间不得为空")
    private Date admissionDateTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "出科时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date dischargeDateTime;
    @Excel(name = "转向科室代码")
    private String deptTransferedTo;
    @Excel(name="经治医生")
    private String doctorInCharge;
    @Data
    public static class primaryKey {
        private final String patientId;
        private final Integer visitId;
        private final Date admissionDateTime;
        public primaryKey(String patientId,Integer visitId, Date admissionDateTime) {
            this.patientId = patientId;
            this.visitId = visitId;
            this.admissionDateTime = admissionDateTime;
        }
    }

    public void setDoctorInCharge(String doctorInCharge) {
        this.doctorInCharge = trim(doctorInCharge);
    }
}
